<template>
  <div class="concave-title-container">
    <div class="title-content">
      <slot></slot>
    </div>
  </div>
</template>

<script lang="ts" name="ConcaveTitle" setup></script>

<style scoped>
.concave-title-container {
  position: relative;
  display: inline-block;
  padding: 20px 40px;
  margin: 30px 0;
  text-align: center;

  /* 凹形背景 */
  background: linear-gradient(145deg, #0a192f, #0c1f3d);
  border-radius: 10px;
  box-shadow: inset 3px 3px 6px rgba(0, 0, 0, 0.5),
    inset -3px -3px 6px rgba(64, 128, 255, 0.1);

  /* 底部光效容器 */
  &::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 20%;
    right: 20%;
    height: 2px;
    background: linear-gradient(
      90deg,
      transparent,
      #64ffda,
      #4fc3f7,
      #64ffda,
      transparent
    );
    background-size: 200% 100%;
    animation: lightFlow 3s linear infinite;
    filter: blur(1px);
    z-index: 1;
    transition: all 0.3s ease;
  }

  /* 悬停时光效增强 */
  &:hover::after {
    height: 3px;
    filter: blur(1.5px);
    background: linear-gradient(
      90deg,
      transparent,
      #64ffda,
      #64ffda,
      #4fc3f7,
      #64ffda,
      #64ffda,
      transparent
    );
  }

  /* 两侧装饰线条 */
  &::before {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(
      90deg,
      transparent,
      rgba(100, 255, 218, 0.3),
      rgba(100, 255, 218, 0.7),
      rgba(100, 255, 218, 0.3),
      transparent
    );
  }
}

.title-content {
  position: relative;
  display: inline-block;
  color: #ccd6f6;
  font-size: 1.8rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-shadow: 0 0 10px rgba(100, 255, 218, 0.3);

  /* 文案两侧上升的线条 */
  &::before,
  &::after {
    content: '';
    position: absolute;
    bottom: -12px;
    height: 15px;
    width: 1px;
    background: linear-gradient(to top, rgba(100, 255, 218, 0.8), transparent);
  }

  &::before {
    left: -5px;
  }

  &::after {
    right: -5px;
  }
}

/* 光效流动动画 */
@keyframes lightFlow {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}
</style>
